<script type="text/javascript">
$(document).ready(function(){
	var is_setup = $("#is_pass_setup").val();
	if(is_setup=='1'){	
		$.ajax({
		url: '<?php echo base_url();?>password_setup',
		success:function(response){
			$("#main-content-wrap").html(response);
		}//end success
	
		});//end ajax
		return false;
	}
	return false;
 });
</script>

<div id = "main-content-area">
	<div class="rem_top_wrapper">
		<div id="btn-addpost">
			<p>Add Post</p>
		</div>
		<div class="rem_pagination fright"><?php echo !empty($pagination) ? $pagination : '';?></div>
	</div>
	<div id = "add_remwall">
		<div id = "top-receptients">
			<h2>Add Post</h2>
		</div>
		<div id = "con-recipients">
			<form id = "add_remwall_frm" name = "add_remwall_frm">
			<?php $userinfo = myuser_helper::getUserData(); ?>
				<input type = "hidden" name="uname" id="uname" value="<?php echo $userinfo->firstname.' '.$userinfo->lastname;?>"/>
				<input id = "base_path" type = "hidden" value = "<?php echo base_url();?>"/>
				<input type="hidden" name="file_name" id="file_name"/>
				<div class = "error-r"></div>
				<div class = "loader"><img src = "<?php echo base_url();?>assets/images/ajax-loader.gif" alt = "loader" /></div>
				<p class = "add-recep"><input type = "text" value = "Name of the Person" name = "add-remwall-name" id = "add-remwall-name" /></p>
				<?php $months = array('January','February','March','April','May','June','July','August','September','October','November','December'); ?>
				<p class = "add-recep">
					<label class="fleft">Birthday:</label>
					<select name="sel_birthday_month" id="sel_birthday_month">
						<option value="">Month</option>
						<?php 
							foreach ($months as $value => $name ){
						?>
							   <option value="<?php echo $value+1; ?>"><?php echo $name;?></option>
						<?php }//end foreach ?>
					</select>
					<select name="sel_birthday_day" id="sel_birthday_day">
						<option value="">Day</option>
						<?php
							for($day=1;$day<=31;$day++){
								echo '<option value="'.$day.'" ';
								echo '>'. $day .'</option>';
							}
						?>
					</select>
					<select name="sel_birthday_year" id="sel_birthday_year">
						<option value="">Year</option>
						<?php
							for($year=date('Y');$year>=1960;$year--){
								echo '<option value="'.$year.'" ';
								echo '>'. $year .'</option>';
							}
						?>
					</select>
				</p>
				<p class="add-recep">
					<label class="fleft">Date of Death:</label>
					<select name="sel_death_month" id="sel_death_month">
						<option value="">Month</option>
						<?php 
							foreach ($months as $value => $name ){
						?>
							   <option value="<?php echo $value+1; ?>"><?php echo $name;?></option>
						<?php }//end foreach ?>
					</select>
					<select name="sel_death_day" id="sel_death_day">
						<option value="">Day</option>
						<?php
							for($day=1;$day<=31;$day++){
								echo '<option value="'.$day.'" ';
								echo '>'. $day .'</option>';
							}
						?>
					</select>
					<select name="sel_death_year" id="sel_death_year">
						<option value="">Year</option>
						<?php
							for($year=date('Y');$year>=1960;$year--){
								echo '<option value="'.$year.'" ';
								echo '>'. $year .'</option>';
							}
						?>
					</select>
				</p>
				<p class = "add-recep">
					<textarea name="add-remwall-msg" id="add-remwall-msg">Message</textarea>
				</p>
				<div class="rem_vflower_wrapper fright">
					<div class="rem_p_icon fleft"></div>
					<div class="add fleft">
						<a href="javascript:void(0);" id="add_flower" class="fleft">
							<span class="fontbb002a fleft">Add</span>
							<span class="font796d70 fleft">&nbsp;Virtual Flower</span>
							<div class="slidedown_icon fleft"></div>
						</a>
					</div>
					<div class="clear"></div>
				</div>
				<div class="clear"></div>
				<div class="flower_gallery_wrapper">
					<div class="fleft">Select Virtual Flower</div>
					<div class="clear"></div>
					<div class="flower_gallery">
						<ul id="flower_list">
							<li><a href="javascript:void(0)"><img src="<?php echo base_url();?>assets/images/wall/flower1_thumb.png" alt="f01"/></a></li>
							<li><a href="javascript:void(0)"><img src="<?php echo base_url();?>assets/images/wall/flower2_thumb.png" alt="f02"/></a></li>
							<li><a href="javascript:void(0)"><img src="<?php echo base_url();?>assets/images/wall/flower3_thumb.png" alt="f03"/></a></li>
						</ul>
					</div>
				</div>
				<p style = "margin:20px 20px 0 0;" class="fright">
					<input type="button" value="" alt="" id="remem-submit" />
					<input type="button" value="" alt="" id="rem-cancel" />
				</p>
			</form>
		</div>
	</div>
	<!-- input type hidden -->	
		<input type="hidden" id="toX" name="toX" value="0" />
		<input type="hidden" id="toY" name="toY" value="0" />
	<!-- end input type hidden -->
	
	<div id = "main-content-wrap" style="height:600px;" class="scroll-pane" >
		<div class="rem_wrapper">
			<?php if(count($records_wall) > 0){ 
					foreach($records_wall as $record){
					?>
						<div class="rem_msg_content">
							<?php $img_path = $_SERVER['DOCUMENT_ROOT'].'/mlme2/assets/images'.$record['picture']; ?>
							<div class="recipient-thumbs fleft">
								<?php 
									$basePath = base_url();
									$userPic = (file_exists($img_path) && !empty($record['picture']))? $basePath.'assets/images'.$record['picture'] :$basePath.'assets/images/default.png';
									$src = image_helper::resize_photo($userPic, '52', '52'); 
								?>
								<img src="<?php echo $src;?>" alt=""/>
							</div>
							<div class="fleft w400">
								<div class ="rem_name"><?php echo Myuser_helper::getFullName($record['userid']);?></div>
								<div class="rem_virtual_wrapper">
								<?php if(!empty($record['files'])):?>
									<div class="fleft mright10">
										<img src="<?php echo base_url();?>assets/images/wall/<?php echo $record['files'];?>" alt="message file" class="virtual_fl"/>
									</div>
								<?php endif;?>
									<p class="rem_msg"><?php echo $record['message'];?></p>
									<div class="clear"></div>
								</div>
								<?php if(strtolower($record['post_to']) != 'public') :?>
									<div class="rem_posted">
										<?php if(!empty($record['files'])):?><div class="rem_p_icon fleft"></div><?php endif;?>
										<div class="fleft rem_date"><?php echo date('F j, Y, g:i a',strtotime($record['date_added'])); ?></div>
										<div class="clear"></div>
									</div>
									<div class="rem_posted">
										<div class="fleft">Posted to:</div>
										<div class="postedto_icon fleft"></div>
										<div class="f999 fleft"><?php echo (strlen($record['post_to']) <=15 ) ? $record['post_to']:substr($record['post_to'],0,14).'...';?></div>
										<div class="cal_icon fleft"></div>
										<div class="fleft">
											<?php 
												$date = Myuser_helper::get_post_birth_death_date($record['postid']);
												echo date('M d, Y',strtotime($date['birthday'])).'-'.date('M d, Y',strtotime($date['date_of_death']));
											?>
										</div>
										<div class="clear"></div>
									</div>
								<?php endif;?>
							</div>
							<div class="clear"></div>
						</div>
					<?php 
					}//end foreach
				}//end if
			?>
		</div>
	</div>
	<!-- input type hidden for  -->	
		<input type="hidden" value="<?php echo ($records->password_setup_status == 0) ? '1' : ''; ?>" id="is_pass_setup">
	
</div>